import pandas as pd
import os

class DataLoader:
    def __init__(self, config=None):
        self.config = config
        self.base_dir = os.path.dirname(os.path.abspath(__file__))
        
    def load_data(self):
        """加载数据集"""
        if self.config and hasattr(self.config, 'data_path'):
            file_path = self.config.data_path
        else:
            # 默认数据路径
            file_path = os.path.join(self.base_dir, 'data', 'heart_disease_full.csv')
            
        if not os.path.exists(file_path):
            raise FileNotFoundError(f"数据文件不存在: {file_path}")
            
        return pd.read_csv(file_path) 